# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=melonds
pkgver=0.9.4
pkgrel=0
pkgdesc="Nintendo DS Emulator"
url="http://melonds.kuribo64.net/"
arch="all !armv7 !aarch64 !armhf" # arm disabled due to missing OpenGL on qt5-qtbase
license="GPL-3.0-or-later"
makedepends="cmake pkgconf libslirp-dev libepoxy-dev libarchive-dev sdl2-dev qt5-qtbase-dev"
source="
	0000-remove-failing-assertion-x86.patch
	$pkgname-$pkgver.tar.gz::https://github.com/Arisotura/melonDS/archive/$pkgver.tar.gz
	"
options="!check" # No test suite
builddir="$srcdir/melonDS-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		$CMAKE_CROSSOPTS .
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="
d5cabf1dfc3932bae2b939b4f87efd1caf14499d98f324f9013bd3e7ff33656e676c32d92ed912137a68f5e48163082472d722113d2957080174b187be52940f  0000-remove-failing-assertion-x86.patch
76886ecfbabd00ae9261c33fcd4074b20e989f4357575bf68139538136fb0ba728d7590310ce4ae9c45670ee01ec315046f03f54e7ca9a359be202709b030f6d  melonds-0.9.4.tar.gz
"
